<template>
	<view class="container">
		<view class="header-box" :style="{ height: wininfo.height + 'px', paddingTop: wininfo.top + 'px' }">
			<view class="header-info">
				<tui-icon name="arrowleft" @tap="goBack" color="#333333" size="25" bold="true"></tui-icon>
				<view class="header-name">评价</view>
			</view>
			<view class="add-Pinglun" v-if="wininfo.hostName != 'WeChat'">
				<tui-icon name="add-fill" color="#999" size="20" bold="true"></tui-icon>
				<view>添加评价</view>
			</view>
		</view>
		<view class="add-jingli" @tap="addJingli" v-if="wininfo.hostName == 'WeChat'">
			<tui-icon name="plus" color="#FB353B" size="20" bold="true"></tui-icon>
			<view>添加评价</view>
		</view>
	</view>
	
</template>

<script>
export default {
	data() {
		return {
			Islogin: this.Microi.IsLogin(),
			CurrentUser: this.Microi.GetCurrentUser(),
			startTime: 0,
			options: {},
			wininfo: {}
		};
	},
	mounted() {
		let obj = {};
		// #ifdef MP-WEIXIN
		obj = wx.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-BAIDU
		obj = swan.getMenuButtonBoundingClientRect();
		// #endif
		// #ifdef MP-ALIPAY
		my.hideAddToDesktopMenu();
		// #endif

		setTimeout(() => {
			uni.getSystemInfo({
				success: (res) => {
					console.log(res);
					this.wininfo = res;
					this.wininfo.width = obj.left || res.windowWidth;
					this.wininfo.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44;
					this.wininfo.top = obj.top ? obj.top + (obj.height - 32) / 2 : res.statusBarHeight + 6;
					this.wininfo.scrollH = res.windowWidth;
				}
			});
		}, 0);
	},

	onLoad(options) {
		this.options = options;
	},
	onShow() {
		this.startTime = new Date();
	},
	onHide() {
		if (this.Islogin) {
			// 获取当前页面栈
			const pages = getCurrentPages();
			// 获取当前页面的对象
			const currentPage = pages[pages.length - 1];
			// 获取当前页面的路径
			const route = currentPage.route;
			// 获取当前页面的参数
			const options = currentPage.options;
			this.Microi.ApiEngine.Run('Add_liulanLog', {
				YemianCS: options,
				YemianDZ: route,
				LiulanSJC: new Date().getTime() - this.startTime.getTime()
			});
		}
	},
	onUnload() {
		if (this.Islogin) {
			// 获取当前页面栈
			const pages = getCurrentPages();
			// 获取当前页面的对象
			const currentPage = pages[pages.length - 1];
			// 获取当前页面的路径
			const route = currentPage.route;
			// 获取当前页面的参数
			const options = currentPage.options;
			this.Microi.ApiEngine.Run('Add_liulanLog', {
				YemianCS: options,
				YemianDZ: route,
				LiulanSJC: new Date().getTime() - this.startTime.getTime()
			});
		}
	},
	methods: {}
};
</script>

<style>
	page{
		background-color: #fff;
	}
.container {
	background-color: #fff;
	padding: 175rpx 20rpx 150rpx 20rpx;
	color: #000;
	box-sizing: border-box;
}

.header-box {
	width: 100%;
	position: fixed;
	left: 0;
	top: 0;
	z-index: 999;
	background-color: #fff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	box-sizing: border-box;
}
.header-name {
	font-family: PingFang SC, PingFang SC;
	font-weight: 800;
	font-size: 36rpx;
	color: #181818;
	text-align: center;
	font-style: normal;
	text-transform: none;
}
.header-info {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 20rpx;
}
.header-btn {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 20rpx;
}
.header-btn image {
	width: 44rpx;
	height: 44rpx;
}
.hearder-container {
	padding: 20rpx 0;
	border-bottom: 2rpx solid #f4f5f6;
}

.no-Data {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	font-size: 25rpx;
	color: #999999;
	margin: auto;
	margin-top: 200rpx;
}
.no-Data image {
	width: 200rpx;
}
.add-Pinglun {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 196rpx;
	height: 60rpx;
	background: #f4f5f6;
	border-radius: 30rpx 30rpx 30rpx 30rpx;
	gap: 12rpx;

	font-family: PingFang SC, PingFang SC;
	/* font-weight: 500; */
	font-size: 28rpx;
	color: #666666;
	text-align: left;
	font-style: normal;
	text-transform: none;
}
.add-Pinglun image {
	width: 36rpx;
	height: 36rpx;
}
.add-jingli {
	width: 688rpx;
	height: 104rpx;
	background: #edf1f6;
	border-radius: 20rpx 20rpx 20rpx 20rpx;
	line-height: 104rpx;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 32rpx;

	font-family: PingFang SC, PingFang SC;
	font-weight: 800;
	font-size: 32rpx;
	color: #333333;
	text-align: left;
	font-style: normal;
	text-transform: none;
	padding: 0 26rpx;
	box-sizing: border-box;
}
.add-jingli image {
	width: 60rpx;
	height: 60rpx;
}
</style>
